package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.StudentServiceHyx;
import com.zr.serviceImpl.StudentServiceImplHyx;

public class AdminUptStudentControllerHyx extends HttpServlet{
	
	StudentServiceHyx sService = new StudentServiceImplHyx();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("UTF-8");
		resp.setCharacterEncoding("UTF-8");
		int sid = Integer.parseInt( req.getParameter("sid"));
		String sname = req.getParameter("sname");
		String sage = req.getParameter("sage");
		String ssex = req.getParameter("ssex");
		String saddress = req.getParameter("saddress");
		String spnumber = req.getParameter("spnumber");
		String stime = req.getParameter("stime");
		String bname = req.getParameter("banji");
		boolean flag = sService.adminUpdateStudent(sid, sname, sage, ssex, saddress, spnumber, stime, bname);
		PrintWriter pw = resp.getWriter();
		if(flag==true){
			pw.write("1");
		}else{
			pw.write("0");
		}	
		pw.flush();
		pw.close();	
		
	}
}
